package com.bee.beemanage.api.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bee.beemanage.api.service.SysPermissionService;
import com.bee.beemanage.api.entity.SysPermission;
import com.bee.beemanage.api.mapper.SysPermissionMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bee.beemanage.system.common.utils.result.Result;
import com.bee.beemanage.system.common.utils.result.ResultTool;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 权限表 服务实现类
 * </p>
 *
 * @author 陈国松
 * @since 2022-10-09
 */
@Service
public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, SysPermission> implements SysPermissionService {

    @Resource
    SysPermissionMapper sysPermissionMapper;

    @Override
    public List<SysPermission> selectListByUserId(String userId) {
        return sysPermissionMapper.selectListByUserId(userId);
    }

    @Override
    public Page<SysPermission> recycleSearch(Page<SysPermission> page, SysPermission sysPermission, LocalDateTime startTime, LocalDateTime endTime) {
        return sysPermissionMapper.recycleSearch(page,sysPermission,startTime,endTime);
    }

    @Override
    public boolean recover(List<String> idsList) {
        return sysPermissionMapper.recover(idsList);
    }

    @Override
    public Result clear() {
        Result result = ResultTool.success();
        sysPermissionMapper.clear();
        return result;
    }
}
